#include <sys_head.h>
int main(int argc, char const *argv[])
{
    //打开文件
    int fd = open("HQYJ.txt",O_CREAT | O_RDWR | O_TRUNC, 0666);
    if (EOF == fd)
    {
        ERRLOG("open");
        return -1;
    }
    char buf[128] = "ssize_t read(int fd, void *buf, size_t count);\n";
    //文件写入
    write(fd,buf,strlen(buf));

    //移动光标
    lseek(fd,0,SEEK_SET);

    //读取文件
    memset(buf,0,sizeof(buf));
    read(fd,buf,sizeof(buf));
    printf("%s",buf);
    
    //关闭文件
    close(fd);
    return 0;
}